<template>
<div>
  <el-dialog
    :title="title"
    :close-on-click-modal="false"
     v-dialogDrag
    :visible.sync="visible">
    <el-steps :active="active" align-center>
        <el-step title="基本信息"></el-step>
        <el-step title="地址信息"></el-step>
    </el-steps>
    <el-form :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="method==='view'"
             label-width="120px">
      <div v-show="active == 1">
        <el-row  :gutter="15">
        <el-col :span="12">
            <el-form-item label="发布人手机号" prop="publisher.id"
                :rules="[
                  {required: true, message:'发布人手机号不能为空', trigger:'blur'}
                 ]">
          <GridSelect
            title="选择发布人手机号"
            labelName = 'phone'
            labelValue = 'id'
            :value = "inputForm.publisher.id"
            :limit="1"
            @getValue='(value) => {inputForm.publisher.id=value}'
            :columns="[
            {
              prop: 'id',
              label: '主键'
            },
            {
              prop: 'phone',
              label: '手机号(账号唯一)'
            },
            {
              prop: 'nikeName',
              label: '昵称'
            }
            ]"
            :searchs="[
            {
              prop: 'phone',
              label: '手机号(账号唯一)'
            },
            {
              prop: 'nikeName',
              label: '昵称'
            }
            ]"
            dataListUrl="/userinfo/tUserInfo/list"
            entityBeanName="tUserInfo"
            queryEntityUrl="/userinfo/tUserInfo/queryById">
          </GridSelect>
           </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="企业全称" prop="title"
              :rules="[
               ]">
            <el-input v-model="inputForm.certification.enterpriseFullName"      ></el-input>
         </el-form-item>
      </el-col>
        <!-- <el-col :span="12" v-if="inputForm.recruitmentType==1">
            <el-form-item label="企业全称" prop="certification.id"
                :rules="[
                 ]">
          <GridSelect
            title="选择企业全称"
            labelName = 'enterpriseFullName'
            labelValue = 'id'
            :value = "inputForm.certification.id"
            :limit="1"
            @getValue='(value) => {inputForm.certification.id=value}'
            :columns="[
            {
              prop: 'id',
              label: '主键'
            },
            {
              prop: 'enterpriseFullName',
              label: '企业全称'
            },
            {
              prop: 'unifiedSocialCreditCode',
              label: '统一社会信用代码'
            },
            {
              prop: 'companySize',
              label: '公司规模'
            },
            {
              prop: 'legalPersonName',
              label: '法人姓名'
            },
            {
              prop: 'attentionLine',
              label: '经办人姓名'
            },
            {
              prop: 'operatorsTelephone',
              label: '经办人电话'
            },
            {
              prop: 'affiliationIndustry',
              label: '所属行业'
            }
            ]"
            :searchs="[
            {
              prop: 'enterpriseFullName',
              label: '企业全称'
            },
            {
              prop: 'unifiedSocialCreditCode',
              label: '统一社会信用代码'
            },
            {
              prop: 'legalPersonName',
              label: '法人姓名'
            },
            {
              prop: 'attentionLine',
              label: '经办人姓名'
            },
            {
              prop: 'operatorsTelephone',
              label: '经办人电话'
            },
            {
              prop: 'affiliationIndustry',
              label: '所属行业'
            }
            ]"
            dataListUrl="/p_enterprisecertification/pEnterpriseCertification/list"
            entityBeanName="pEnterpriseCertification"
            queryEntityUrl="/p_enterprisecertification/pEnterpriseCertification/queryById">
          </GridSelect>
           </el-form-item>
        </el-col> -->
        <el-col :span="12">
            <el-form-item label="业务类型" prop="bussinessType"
                :rules="[
                  {required: true, message:'业务类型不能为空', trigger:'blur'}
                 ]">
                    <el-radio-group v-model="inputForm.bussinessType"  >
                        <el-radio label="1">房产</el-radio>
                        <el-radio label="2">车主</el-radio>
                        <el-radio label="4">招聘</el-radio>
                  </el-radio-group>
           </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="招聘类型" prop="recruitmentType"
                :rules="[
                  {required: true, message:'招聘类型不能为空', trigger:'blur'}
                 ]">
                 <el-radio-group v-model="inputForm.recruitmentType">
                        <el-radio label="1">全职</el-radio>
                        <el-radio label="2">兼职</el-radio>
                  </el-radio-group>
           </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="标题" prop="title"
                :rules="[
                  {required: true, message:'标题不能为空', trigger:'blur'}
                 ]">
              <el-input v-model="inputForm.title" placeholder="请填写标题"     ></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="职位名称" prop="positionCategory"
                :rules="[
                  {required: true, message:'职位名称不能为空', trigger:'blur'}
                 ]">
                 <!-- <el-cascader placeholder="试试搜索：指南" :options="industryTypeList" filterable >
                    <template slot-scope="{ node, data }">
                      <span>{{ data.lableName }}</span>
                      <span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
                    </template>
                  </el-cascader> -->
              <el-input v-model="inputForm.positionCategory" placeholder="请填写职位名称"   disabled   ></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="12" v-if="inputForm.recruitmentType==1">
            <el-form-item label="工作年限" prop="yearsService"
                :rules="[

                 ]">
                 <!-- <el-select v-model="inputForm.yearsService" placeholder="请选择工作年限">
                    <el-option
                      v-for="item in workYeas"
                      :key="item.valueName"
                      :label="item.valueName"
                      :value="item.valueName">
                    </el-option>
                  </el-select> -->
              <el-input v-model="inputForm.yearsService" placeholder="请填写工作年限"   disabled   ></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="12"  v-if="inputForm.recruitmentType==1">
            <el-form-item label="学历要求" prop="educationalRequirements"
                :rules="[

                 ]">
                 <!-- <el-select v-model="inputForm.educationalRequirements" placeholder="请选择学历要求">
                    <el-option
                      v-for="item in educational"
                      :key="item.valueName"
                      :label="item.valueName"
                      :value="item.valueName">
                    </el-option>
                  </el-select> -->
              <el-input v-model="inputForm.educationalRequirements" placeholder="请填写学历要求"  disabled    ></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="薪资范围" prop="salaryRange"
                :rules="[
                  {required: true, message:'薪资范围不能为空', trigger:'blur'}
                 ]">
              <el-input v-model="inputForm.salaryRange" placeholder="请填写薪资范围"   disabled   ></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="福利待遇" prop="fringeBenefits"
                :rules="[

                ]">
                <!-- <el-select v-model="inputForm.fringeBenefits"  placeholder="请选择福利待遇">
                    <el-option
                      v-for="item in fl"
                      :key="item.valueName"
                      :label="item.valueName"
                      :value="item.valueName">
                    </el-option>
                  </el-select> -->
              <el-input v-model="inputForm.fringeBenefits" placeholder="请填写福利待遇"   disabled:false   ></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="12" v-if="inputForm.recruitmentType==1">
            <el-form-item label="招聘人数" prop="recruitNumber"
                :rules="[

                ]">
              <el-input v-model="inputForm.recruitNumber" placeholder="请填写招聘人数"      ></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="12" v-if="inputForm.recruitmentType==2">
            <el-form-item label="结算方式" prop="settlementMethod"
                :rules="[
                  {required: true, message:'结算方式不能为空', trigger:'blur'}
                 ]">
              <el-input v-model="inputForm.settlementMethod" placeholder="请填写结算方式"   disabled  ></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="12" v-if="inputForm.recruitmentType==2">
            <el-form-item label="工作周期" prop="workCycle"
                :rules="[
                  {required: true, message:'工作周期不能为空', trigger:'blur'}
                 ]">
              <el-input v-model="inputForm.workCycle" placeholder="请填写工作周期"  disabled   ></el-input>
           </el-form-item>
        </el-col>
        <!-- <el-col :span="12">
            <el-form-item label="职位类别" prop="positionCategory"
                :rules="[
                  {required: true, message:'职位类别不能为空', trigger:'blur'}
                 ]">
              <el-input v-model="inputForm.positionCategory" placeholder="请填写职位类别"     ></el-input>
           </el-form-item>
        </el-col> -->
        <el-col :span="12">
            <el-form-item label="联系电话" prop="contactNumber"
                :rules="[
                  {required: true, message:'联系电话不能为空', trigger:'blur'}
                 ]">
              <el-input v-model="inputForm.contactNumber" placeholder="请填写联系电话"     ></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="工作区域" prop="region"
                :rules="[
                  {required: true, message:'工作区域不能为空', trigger:'blur'}
                 ]">
              <el-input v-model="inputForm.region" placeholder="请填写工作区域"     ></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="12" v-if="inputForm.recruitmentType==2">
            <el-form-item label="招聘人数" prop="recruitersNumber"
                :rules="[

                 ]">
              <el-input v-model="inputForm.recruitersNumber" placeholder="请填写招聘人数"     ></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="12" v-if="inputForm.recruitmentType==2">
            <el-form-item label="性别要求" prop="genderRequirements"
                :rules="[

                 ]">
                    <el-radio-group v-model="inputForm.genderRequirements">
                        <el-radio v-for="item in $dictUtils.getDictList('sex')" :label="item.value" :key="item.id">{{item.label}}</el-radio>
                    </el-radio-group>
           </el-form-item>
        </el-col>
        <el-col :span="12" v-if="inputForm.recruitmentType==2">
            <el-form-item label="工作时段" prop="workingHours"
                :rules="[

                 ]">
              <el-input v-model="inputForm.workingHours" placeholder="请填写工作时段"  disabled   ></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="12" v-if="inputForm.recruitmentType==2">
            <el-form-item label="用工日期" prop="employmentDate"
                :rules="[

                 ]">
              <el-input v-model="inputForm.employmentDate" placeholder="请填写用工日期"   disabled  ></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="24">
            <el-form-item label="职位描述" prop="jobDescription"
                :rules="[
                  {required: true, message:'职位描述不能为空', trigger:'blur'}
                 ]">
          <el-input type="textarea" rows="5" v-model="inputForm.jobDescription" placeholder="请填写职位描述"     ></el-input>
           </el-form-item>
        </el-col>
        <!-- <el-col :span="12">
            <el-form-item label="位置排序" prop="positionSort"
                :rules="[
                 ]">
              <el-input v-model="inputForm.positionSort" placeholder="请填写位置排序"     ></el-input>
           </el-form-item>
        </el-col> -->
        <el-col :span="12">
            <el-form-item label="审核状态" prop="auditStatus"
                :rules="[
                 ]">
                    <el-select
                  v-model="inputForm.auditStatus"
                  placeholder="请选择审核状态"
                  style="width: 100%"
                >
                  <el-option label="待审核" value="0"></el-option>
                  <el-option label="已通过" value="1"></el-option>
                  <el-option label="已拒绝" value="2"></el-option>
                </el-select>
           </el-form-item>
        </el-col>

        <el-col :span="12">
            <el-form-item label="审核时间" prop="auditTime"
                :rules="[
                 ]">
                <el-date-picker
                      style="width: 100%;"
                      v-model="inputForm.auditTime"
                      type="datetime"
                      value-format="yyyy-MM-dd HH:mm:ss"
                      placeholder="选择日期时间">
                    </el-date-picker>
           </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="上架状态" prop="shelfStatus"
                :rules="[
                 ]">
                    <el-select
                  v-model="inputForm.shelfStatus"
                  placeholder="请选择上架状态"
                  style="width: 100%"
                >
                  <el-option label="未上架" value="0"></el-option>
                  <el-option label="已上架" value="1"></el-option>
                </el-select>
           </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="是否为推荐招聘" prop="whetherRecommendedRecruitment"
                :rules="[
                 ]">
                    <el-select
                  v-model="inputForm.whetherRecommendedRecruitment"
                  placeholder="请选择是否为推荐"
                  style="width: 100%"
                >
                  <el-option label="否" value="0"></el-option>
                  <el-option label="是" value="1"></el-option>
                </el-select>
           </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="是否置顶到大首页" prop="whetherTopHome"
                :rules="[
                 ]">
                    <el-select
                  v-model="inputForm.whetherTopHome"
                  placeholder="请选择是否置顶到大首页"
                  style="width: 100%"
                >
                  <el-option label="不置顶到大首页" value="0"></el-option>
                  <el-option label="置顶到大首页" value="1"></el-option>
                </el-select>
           </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="是否首页显示" prop="homeDisplay"
                :rules="[
                 ]">
                    <el-select
                  v-model="inputForm.homeDisplay"
                  placeholder="请选择是否首页显示"
                  style="width: 100%"
                >
                  <el-option label="隐藏" value="0"></el-option>
                  <el-option label="显示" value="1"></el-option>
                </el-select>
           </el-form-item>
        </el-col>
        <el-col :span="12" v-if="inputForm.whetherTopHome==1">
            <el-form-item label="首页置顶天数" prop="topSettingDays"
                :rules="[
                 ]">
              <el-input v-model="inputForm.topSettingDays" placeholder="请填写首页置顶天数"     ></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="12" v-if="inputForm.whetherTopHome==1">
            <el-form-item label="首页置顶时间" prop="topSettingTimes"
                :rules="[
                 ]">
              <el-input v-model="inputForm.topSettingTimes" placeholder="请填写首页置顶时间"     ></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="拒绝原因" prop="reasonRejection"
              :rules="[
               ]">
            <el-input type="textarea" rows="5" v-model="inputForm.reasonRejection" placeholder="请填写拒绝原因"     ></el-input>
         </el-form-item>
      </el-col>
        <el-col :span="24">
            <el-form-item label="备注信息" prop="remarks"
                :rules="[
                 ]">
          <el-input type="textarea" v-model="inputForm.remarks" placeholder="请填写备注信息"     ></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="24" v-if="inputForm.recruitmentType==1">
          <el-form-item label="公司简介" prop="companyProfile"
              :rules="[
               ]">
            <el-input type="textarea" rows="5" v-model="inputForm.companyProfile" placeholder="请填写公司简介"     ></el-input>
         </el-form-item>
      </el-col>
        <el-col :span="24" v-if="inputForm.introductionPicture && inputForm.recruitmentType==1">
              <el-form-item label="简介图片" prop="introductionPicture" :rules="[]">
                <el-upload ref="introductionPicture" v-if="visible" list-type="picture-card"
                  :action="`${this.$http.BASE_URL}/sys/file/webupload/upload?uploadPath=/pRecruitmentinformation/pRecruitmentinformation`"
                  :headers="{ token: $cookie.get('token') }" :on-preview="
                    (file, fileList) => {
                      showImg(file.url);
                    }
                  " :on-success="
                    (response, file, fileList) => {
                      inputForm.introductionPicture = fileList
                        .map(
                          (item) =>
                            (item.response && item.response.url) || item.url
                        )
                        .join('|');
                    }
                  " :on-remove="
                    (file, fileList) => {
                      $http
                        .post(
                          `/sys/file/webupload/deleteByUrl?url=${
                            (file.response && file.response.url) || file.url
                          }`
                        )
                        .then(({ data }) => {
                          $message.success(data.msg);
                        });
                      inputForm.introductionPicture = fileList
                        .map((item) => item.url)
                        .join('|');
                    }
                  " :before-remove="
                    (file, fileList) => {
                      return $confirm(`确定移除 ${file.name}？`);
                    }
                  " multiple :limit="5" :on-exceed="
                    (files, fileList) => {
                      $message.warning(
                        `当前限制选择 5 个文件，本次选择了 ${
                          files.length
                        } 个文件，共选择了 ${
                          files.length + fileList.length
                        } 个文件`
                      );
                    }
                  " :file-list="introductionPictureArra">
                  <i class="el-icon-plus"></i>
                </el-upload>
              </el-form-item>
            </el-col>
        </el-row>
      </div>
      <div v-show="active == 2">
        <el-row  :gutter="15">
          <el-col :span="12" v-if="inputForm.recruitmentType==2">
            <el-form-item label="所在区域" prop="region"
                :rules="[
                 ]">
              <el-input v-model="inputForm.region" placeholder="请填写所在区域"     ></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="工作地点" prop="workLocation"
                :rules="[
                  {required: true, message:'工作地点不能为空', trigger:'blur'}
                 ]">
              <el-input v-model="inputForm.workLocation"  ref="handleinput"
                  id="handleinput" placeholder="请填写工作地点"     ></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="经度" prop="longitude"
                :rules="[
                  {required: true, message:'经度不能为空', trigger:'blur'}
                 ]">
              <el-input v-model="inputForm.longitude" placeholder="请填写经度"     ></el-input>
           </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="纬度" prop="latitude"
                :rules="[
                  {required: true, message:'纬度不能为空', trigger:'blur'}
                 ]">
              <el-input v-model="inputForm.latitude" placeholder="请填写纬度"     ></el-input>
           </el-form-item>
        </el-col>
        <el-col>
              <el-form-item label="地图" prop="">
                <div ref="container" id="containepic"></div>
              </el-form-item>
            </el-col>
        </el-row>
      </div>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button v-if="active !== 1" style="margin-top: 12px" @click="upper">上一步</el-button>
      <el-button v-if="active !== 2" style="margin-top: 12px" @click="next">下一步</el-button>
      <el-button
      v-if="inputForm.auditStatus == 0"
      style="margin-top: 12px"
      @click="audit(inputForm.id, 1)"
      >通过</el-button
    >
    <el-button
      v-if="inputForm.auditStatus == 0"
      style="margin-top: 12px"
      @click="refuse(inputForm.id, 2)"
      >拒绝</el-button>
      <el-button @click="visible = false">关闭</el-button>
      <el-button type="primary" v-if="method != 'view'" @click="doSubmit()" v-noMoreClick>确定</el-button>
    </span>
  </el-dialog>
</div>
</template>

<script>
  import GridSelect from '@/components/gridSelect'
  export default {
    data () {
      return {
        title: '',
        method: '',
        visible: false,
        loading: false,
        active:1,
        markersArray:[],
        introductionPictureArra:[],
        inputForm: {
          id: '',
          publisher: {
            id: ''
          },
          certification: {
            id: '',
            enterpriseFullName:''
          },
          bussinessType: '',
          recruitmentType: '',
          title: '',
          positionName: '',
          yearsService: '',
          educationalRequirements: '',
          salaryRange: '',
          fringeBenefits: '',
          recruitNumber:'0',
          companyProfile: '',
          introductionPicture: '',
          settlementMethod: '',
          workCycle: '',
          positionCategory: '',
          region: '',
          workLocation: '',
          longitude: '',
          latitude: '',
          contactNumber: '',
          recruitersNumber: '0',
          genderRequirements: '',
          workingHours: '',
          employmentDate: '',
          jobDescription: '',
          // positionSort: '',
          auditStatus: '',
          reasonRejection: '',
          auditTime: '',
          shelfStatus: '',
          whetherRecommendedRecruitment: '',
          whetherTopHome: '',
          homeDisplay: '',
          topSettingDays: 0,
          topSettingTimes: '',
          remarks: ''
        },
        industryTypeList:[],
        fl:[],
        workYeas:[],
        educational:[]
      }
    },
    components: {
      GridSelect
    },
    methods: {
      getZhiwei(){
        this.$http({
              url: `/api/mobile/personnelOwner/getWholeIndustryType?recruitmentType=1`,
              method: 'get'
            }).then(({data}) => {
              console.log(data);
              this.industryTypeList = data.industryTypeList
            })
      },
      queryDataDictionaryList(){
        this.$http({
              url: `/api/mobile/personnelOwner/queryDataDictionaryList?type=1,2,3`,
              method: 'get'
            }).then(({data}) => {
              console.log(data);
              for(var i = 0;i < data.dataDictionaryList.length;i++){
                if (data.dataDictionaryList[i].type == 1){
                  this.fl.push(data.dataDictionaryList[i]);
                }
                if (data.dataDictionaryList[i].type == 2){
                  this.workYeas.push(data.dataDictionaryList[i]);
                }
                if (data.dataDictionaryList[i].type == 3){
                  this.educational.push(data.dataDictionaryList[i]);
                }
              }
            })
      },
      init (method, id) {
        this.active = '1'
        this.method = method
        this.inputForm.id = id
        if (method === 'add') {
          this.title = `新建招聘信息`
        } else if (method === 'edit') {
          this.title = '修改招聘信息'
        } else if (method === 'view') {
          this.title = '查看招聘信息'
        }
        // this.getZhiwei();
        // this.queryDataDictionaryList();
        this.introductionPictureArra =[]
        this.visible = true
        this.loading = false
        this.$nextTick(() => {
          this.$refs.inputForm.resetFields()
          if (method === 'edit' || method === 'view') { // 修改或者查看
            this.loading = true
            this.$http({
              url: `/p_recruitmentinformation/pRecruitmentInformation/queryById?id=${this.inputForm.id}`,
              method: 'get'
            }).then(({data}) => {
              this.inputForm = this.recover(this.inputForm, data.pRecruitmentInformation)
              this.initMap(this.inputForm.longitude, this.inputForm.latitude);
              if(this.inputForm.introductionPicture){
                this.inputForm.introductionPicture.split("|").forEach((item) => {
                  if (item.trim().length > 0) {
                    this.introductionPictureArra.push({
                      name: decodeURIComponent(
                        item.substring(item.lastIndexOf("/") + 1)
                      ),
                      url: item,
                    });
                  }
                });
              }
              this.loading = false
            })
          }else{
            this.initMap();
          }
        })
      },
      initMap(longitude, latitude) {
        var that = this;
        let address = "";
        let lat = "36.752508224779746";
        let logt = "119.97121810913086";
        if (!longitude) {
          let lat = latitude;
          let logt = longitude;
        }
        if (this.inputForm.latitude === "") {
          var center = new qq.maps.LatLng(lat, logt);
        } else {
          var center = new qq.maps.LatLng(
            this.inputForm.latitude,
            this.inputForm.longitude
          );
        }
        var map = new qq.maps.Map(document.getElementById("containepic"), {
          center: center,
          zoom: 13,
          disableDefaultUI: true,
        });
        var marker = new qq.maps.Marker({
          position: center,
          map: map,
        });
        that.markersArray.push(marker);
        var infoWin = new qq.maps.InfoWindow({
          map: map,
        }); //此处是点击地图后生成的地标名称
        var geocoder = new qq.maps.Geocoder({
          complete: function (res) {
            that.deleteOverlays();
            map.setCenter(res.detail.location);
            var marker = new qq.maps.Marker({
              map: map,
              position: res.detail.location,
            });
            that.markersArray.push(marker);
          },
        });

        qq.maps.event.addListener(map, "click", function (event) {
          that.deleteOverlays();
          // this.latitude = event.latLng.getLat();
          // this.longiistude = event.latLng.getLng();
          // console.log(this.longiistude, this.latitude);
          that.inputForm.longitude = event.latLng.getLng();
          that.inputForm.latitude = event.latLng.getLat();
          var position = new qq.maps.LatLng(
            that.inputForm.latitude,
            that.inputForm.longitude
          );
          var marker = new qq.maps.Marker({
            map: map,
            position: position,
          });
          that.markersArray.push(marker);
        });
        document
          .getElementById("handleinput")
          .addEventListener("blur", function () {
            console.log("1111");
            geocoder.getLocation(that.inputForm.workLocation);
          });
    },
    deleteOverlays() {
      if (this.markersArray) {
        for (var i in this.markersArray) {
          this.markersArray[i].setMap(null);
        }
        this.markersArray.length = 0;
      }
    },
      next() {
        this.active++;
      },
      upper() {
        this.active--;
      },
      audit(id, status) {
        this.$confirm(`确定当前操作?`, "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }).then(() => {
          this.loading = true;
          this.$http({
            url: "/p_recruitmentinformation/pRecruitmentInformation/audit",
            method: "post",
            params: { id: id, auditStatus: status },
          }).then(({ data }) => {
            if (data && data.success) {
              this.visible = false
                this.$message.success(data.msg)
                this.$emit('refreshDataList')
            }
            if (!data.success) {
              this.visible = false
                this.$message.success(data.msg)
                this.$emit('refreshDataList')
            }
            this.loading = false;
          });
        });
      },
      //拒绝审核
      refuse(id, status) {
        this.$prompt("请输入拒绝原因", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
        })
          .then(({ value }) => {
            if (!value){
              this.$message.error("请输入拒绝原因");
              return false
            }
            this.loading = true;
            this.$http({
              url: "/p_recruitmentinformation/pRecruitmentInformation/audit",
              method: "post",
              params: { id: id, auditStatus: status, refuseReason: value },
            }).then(({ data }) => {
              if (data && data.success) {
               this.visible = false
                this.$message.success(data.msg)
                this.$emit('refreshDataList')
              }
              if (!data.success) {
               this.visible = false
                this.$message.success(data.msg)
                this.$emit('refreshDataList')
              }
              this.loading = false;
            });
          })
          .catch(() => {
            this.$message({
              type: "info",
              message: "取消输入",
            });
          });
      },
      // 表单提交
      doSubmit () {
        this.$refs['inputForm'].validate((valid) => {
          if (valid) {
            this.loading = true
            this.$http({
              url: `/p_recruitmentinformation/pRecruitmentInformation/save`,
              method: 'post',
              data: this.inputForm
            }).then(({data}) => {
              this.loading = false
              if (data && data.success) {
                this.visible = false
                this.$message.success(data.msg)
                this.$emit('refreshDataList')
              }
            })
          }
        })
      }
    }
  }
</script>
